<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #app{
            width: 600px;
            height: auto;
            margin: 100px auto;
            border:1px solid;
            padding: 20px;
        }
        #app ul{
            margin-top: 20px;
        }
        #app ul li{
            list-style: none;
            line-height: 50px;
            background-color: rgba(0,0,0,.3);
            border-bottom: 1px solid rgba(255,255,255,.4);
        }
        #app ul li:hover{
            background-color: rgba(0,0,0,.5);
        }
    </style>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        事项：<input type="text" placeholder="请输入待办事项" v-model="thing" @keyup.enter="add"> 
        <ul>
            <li 
                v-for="(item,index) in items" 
                v-on:click="cut(index)" 
                v-show="item.status"
            >{{item.title}}</li>
        </ul>
    </div>
    <script>
        var app = new Vue({
            el:'#app',
            data:{
                thing:'',
                items:[
                    {title:'上午9点开需求分析会',status:true},
                    {title:'中午吃饭睡觉打豆豆',status:true},
                    {title:'下午5点下班前验收项目',status:true}
                ]
            },
            methods:{
                add(){
                    this.items.push({
                        title:this.thing,
                        status:true
                    });
                    this.thing = '';
                },
                cut(index){
                    this.items[index].status = false 
                }
            }
        })
    </script>
</body>
</html>